<?php

/**
 * Medias form base class.
 *
 * @method Medias getObject() Returns the current form's model object
 *
 * @package    sf_sandbox
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseMediasForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'             => new sfWidgetFormInputHidden(),
      'users_id'       => new sfWidgetFormInputText(),
      'defis_id'       => new sfWidgetFormInputText(),
      'description'    => new sfWidgetFormTextarea(),
      'ordre'          => new sfWidgetFormInputText(),
      'type'           => new sfWidgetFormChoice(array('choices' => array('image' => 'image', 'video' => 'video'))),
      'src'            => new sfWidgetFormInputText(),
      'dailymotion_id' => new sfWidgetFormInputText(),
      'etat'           => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'             => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'users_id'       => new sfValidatorInteger(),
      'defis_id'       => new sfValidatorInteger(),
      'description'    => new sfValidatorString(),
      'ordre'          => new sfValidatorInteger(),
      'type'           => new sfValidatorChoice(array('choices' => array(0 => 'image', 1 => 'video'))),
      'src'            => new sfValidatorString(array('max_length' => 255)),
      'dailymotion_id' => new sfValidatorString(array('max_length' => 255)),
      'etat'           => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('medias[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Medias';
  }

}
